package com.example.a28796.beautiful.adapter;

import android.support.v4.view.PagerAdapter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import java.util.List;

/**
 * Created by Administrator on 2016/8/21.
 */
public class HeadPagerAdapter extends PagerAdapter {

    private List<ImageView> mImageView;

    public HeadPagerAdapter(List<ImageView> mData) {
        mImageView = mData;
        Log.i("gaofeng", "HeadPagerAdapter: data"+mImageView.size());
    }
    @Override
    public int getCount() {
        return mImageView==null?0:mImageView.size();
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view ==object;
    }
    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        ImageView imageView =   mImageView.get(position);
        container.addView(imageView);
        return imageView;
    }
    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView(mImageView.get(position));
    }
}
